<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" id="number">
    <input type="button" id="butt" value="判断">

</body>
<script>
    var num = document.getElementById("number");
    var btn = document.getElementById("butt");
    var mu = parseInt(Math.random() * 100 + 1);
    btn.onclick = function () {
        if (num.value == mu) {
            alert("chenggong");
        } else {
            alert("shibai");
        }
        console.log(mu);
    }
</script>

</html>